package com.c2.service.impl;

import com.c2.entity.EbComment;
import com.c2.mapper.CommentMapper;
import com.c2.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 用一句话描述
 * @Auther: 新梦想*陈超
 * @Date: 2020-09-16 15:15
 */
@Service
public class CommentServiceImpl implements CommentService {


    @Autowired
    private CommentMapper commentMapper;

    @Override
    public List<EbComment> listByPage(int page, int pageSize) {
        int from = (page-1)*pageSize;
        return commentMapper.findByPage(from,pageSize);
    }
    @Override
    public Integer getMaxPage(Integer pageSize) {
        return commentMapper.getMaxPage(pageSize);
    }

    @Override
    public EbComment selectOne(Integer ecId) {
        return commentMapper.selectOne(ecId);
    }
    @Override
    public int updateById(EbComment ebComment){
        return commentMapper.updateByPrimaryKey(ebComment);
    }
    @Override
    public int deleteByPk(Integer id) {
        return commentMapper.remove(id);
    }
    @Override
    public int save(EbComment ebComment) {
        System.out.println("调用service方法");
        return commentMapper.save(ebComment);

}

}

